﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Kakeibo.View
{
    public partial class MainForm : Form, IView {

        public MainForm() {
            InitializeComponent();
        }

        public System.Windows.Forms.Control FormControl {
            get { return this; }
        }

        public bool AddMainTabContent(string caption, IView view) {
            TabPage newTabPage = new TabPage(caption);
            view.FormControl.Dock = DockStyle.Fill;
            newTabPage.Controls.Add(view.FormControl);
            mainTabControl.TabPages.Add(newTabPage);

            return true;
        }


        public string showImportDbDialog() {
            var result = importDbDialog.ShowDialog();

            if (result == System.Windows.Forms.DialogResult.OK) {
                return importDbDialog.FileName;
            }
            else {
                return null;
            }
        }


        // events
        public event System.EventHandler OnClickImportDbMenuItem {
            add {
                importDbMenuItem.Click += value;
            }
            remove {
                importDbMenuItem.Click -= value;
            }
        }

        public event System.EventHandler OnClickExitMenuItem {
            add {
                exitMenuItem.Click += value;
            }
            remove {
                exitMenuItem.Click -= value;
            }
        }

    }
}
